<template>
  <div class="">
    <el-tabs
      v-model="miniactiveName"
      @tab-click="minitabChange"
      class="mini-tabs"
    >
      <el-tab-pane
        v-for="(item, index) in minitabArr"
        :key="index"
        :label="item.label"
        :name="item.value"
      ></el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
export default {
  components: {},
  props: {
    minitabArr: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      miniactiveName: null,
    };
  },
  created() {
    if (this.minitabArr.length > 0) {
      this.miniactiveName = this.minitabArr[0].value;
    }
    // console.log(this.miniactiveName);
  },
  mounted() {},
  watch: {
    minitabArr: {
      handler(val) {
        if (val) {
          // if (this.minitabArr.length > 0) {
          //   this.miniactiveName = this.minitabArr[0].value;
          // }
        }
      },
      deep: false,
      immediate: false,
    },
  },
  methods: {
    minitabChange() {
      this.$emit("minitabChange", this.miniactiveName);
    },
  },
};
</script>

<style lang="scss" scoped>
::v-deep .mini-tabs {
  .el-tabs__header {
    // margin: 0 40px;
  }
  .el-tabs__active-bar {
    width: 79px;
  }
  .el-tabs__item {
    font-size: 20px;
    font-weight: 600;
    opacity: 0.8;
  }
  .el-tabs__nav-wrap::after {
    display: none;
  }
}
.mini-tabs {
  // margin: 0 0 0 -30px;
}
</style>
